package com.hhh.tools.ui.screens

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.lifecycle.viewmodel.compose.viewModel
import com.hhh.tools.model.entity.GoodsInfoBean
import com.hhh.tools.viewmodel.CommodityViewModel

@Composable
fun CommodityListScreen(viewModel: CommodityViewModel = viewModel()) {
    LaunchedEffect(Unit) {
        viewModel.loadCommodityList()
    }

    LazyColumn {
        items(viewModel.list) { item ->
            CommodityItem(item)
        }
    }
}

@Composable
fun CommodityItem(item: GoodsInfoBean) {
    Column {
        Text(text = item.name)
    }
}